DOCKER_TAG := $(if $(DOCKER_TAG),$(DOCKER_TAG),icbc-arm)
ARCH := $(if $(ARCH),$(ARCH),arm64)
hub=hub.deepin.com/

docker-build:
	docker volume create --name=yarn_cache
	docker volume create --name=dcmc-web-node_modules
	docker run --rm \
	-v yarn_cache:/usr/local/share/.cache/yarn \
	-v dcmc-web-node_modules:/web/node_modules \
	-v $(CURDIR):/web \
	-v $(CURDIR)/deploy:/deploy \
	-w /web \
	node:8 /bin/bash -c "yarn install && yarn build --output-path /deploy/dist"
# ARCH = amd64/arm64/mips64le
docker:
	docker buildx build -t $(hub)dcmc/web:$(DOCKER_TAG) --platform linux/${ARCH} deploy

docker-icbc:
	docker buildx build -t $(hub)wuhan_dcmc/web:icbc-arm64 --platform linux/arm64 deploy

docker-release:
	docker push $(hub)dcmc/web:$(DOCKER_TAG)

docker-icbc-release:
	docker push $(hub)wuhan_dcmc/web:icbc-arm64
